﻿using Quartz;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyService
{
    public class MyJob: IJob
    {
        private static readonly string[] says = new[] { 
            "我是天才！！！", 
            "本大侠吕奉先加入了，这就代表着天下的胜券在握！", 
            "有我在，就等着收割吧。",
            "鞠躬尽瘁，死而后已...",
            "就如古时的管仲乐毅一般，为大人奉献全部吧",
            "良禽择木而栖，良臣择主而事......",
            "一曲肝肠断，天涯何处匿知音。",
            "有我在，你妥妥的吃！",
            "人生自古谁无死，留取丹心照汗青"
        };
        /// <summary>
        /// 定时任务执行
        /// </summary>
        /// <param name="context"></param>
        public async Task Execute(IJobExecutionContext context)
        {
            var file = Path.Combine(@"D:\Temp", "MyService.log");
            var random = new Random();
            var index = random.Next(0, says.Length - 1);
            File.AppendAllText(file, says[index] + Environment.NewLine);
            await Task.CompletedTask;
        }

    }
}
